import java.io.*;
import java.nio.charset.Charset;

public class Test5 {
    public static void main(String[] args) throws IOException {
//        InputStreamReader isr =new InputStreamReader(new FileInputStream("D:\\poem1.txt"),"GBK");
//        int data;
//        OutputStreamWriter osw=new OutputStreamWriter(new FileOutputStream("D:\\poem2.txt"),"UTF-8");
//        while((data=isr.read())!=-1){
//            osw.write(data);
//        }
//        osw.close();
//        isr.close();
        FileReader fr=new FileReader("D:\\poem1.txt", Charset.forName("GBK"));
        FileWriter fw=new FileWriter("D:\\poem3.txt",Charset.forName("UTF-8"));
        int data;

        while((data=fr.read())!=-1){
            fw.write(data);
        }
        fw.close();
        fr.close();
    }
}
